package biolabs.space;

import java.util.List;

/**
 * Abstract class for a position in a discrete vector space.
 *
 * @param <C> The continuous analog to {@code T}.
 *
 * @author Tomas Mikula
 */
public abstract class DiscretePosition<T extends DiscretePosition<T,C>, C extends ContinuousPosition<C,T>>
		extends Position<T, Integer> {

	/**
	 * Returns the continuous version of this discrete position.
	 */
	public abstract C continuous();

	/**
	 * Returns a new instance whose coordinates are taken from
	 * {@code coords}.
	 * @throws IllegalArgumentException if the number of elements in
	 * {@code coords} is not equal to the dimension of this position vector.
	 */
	public abstract T newInstance(int[] coords);
	
	/**
	 * Returns a list of positions adjacent to this position.
	 */
	public abstract List<T> getNeighbors();

	/**
	 * Returns a new position whose each coordinate is the minimum of
	 * the corresponding coordinates in {@code this} and {@code a}.
	 */
	public abstract T mapMin(T a);

	/**
	 * Returns a new position whose each coordinate is the maximum of
	 * the corresponding coordinates in {@code this} and {@code a}.
	 */
	public abstract T mapMax(T a);
}
